package service

import (
	__ "activity_srv/basic/proto"
	"activity_srv/handler/dao"
	"context"
)

func (s *Serve) Distribution(_ context.Context, in *__.DistributionReq) (*__.DistributionResp, error) {
	distribution, _ := dao.AddDistributionRest(in)
	return &__.DistributionResp{Id: int64(distribution.Id)}, nil
}
func (s *Serve) DistributionSearchList(_ context.Context, in *__.DistributionSearchListReq) (*__.DistributionSearchListResp, error) {
	list, _ := dao.OneDistributionSearchList(in)
	return &__.DistributionSearchListResp{List: list}, nil
}
func (s *Serve) DistributionPoster(_ context.Context, in *__.DistributionPosterReq) (*__.DistributionPosterResp, error) {
	distribution, _ := dao.AddDistributionPoster(in)
	return &__.DistributionPosterResp{Id: int64(distribution.Id)}, nil
}
func (s *Serve) DistributionPosterShow(_ context.Context, in *__.DistributionPosterShowReq) (*__.DistributionPosterShowResp, error) {
	poster, _ := dao.ShowDistributionPoster(in)
	return &__.DistributionPosterShowResp{
		Poster: poster,
	}, nil
}
func (s *Serve) DistributionSearchListProcess(_ context.Context, in *__.DistributionSearchListProcessReq) (*__.DistributionSearchListProcessResp, error) {
	process, _ := dao.DistributionSearchListProcess(in)
	return &__.DistributionSearchListProcessResp{
		Id:          int64(process.Id),
		UserId:      int64(process.UserId),
		Nickname:    process.Nickname,
		FId:         int64(process.FId),
		Mobile:      process.Mobile,
		Price:       int64(process.Price),
		FreezePrice: int64(process.FreezePrice),
		SumPrice:    int64(process.SumPrice),
		OneList:     dao.OneListTwoListDistributionSearchListProcess(int64(process.UserId)),
	}, nil
}
func (s *Serve) AddUserDistributionPosterQuCode(_ context.Context, in *__.AddUserDistributionPosterQuCodeReq) (*__.AddUserDistributionPosterQuCodeResp, error) {
	url, _ := dao.AddUserDistributionPosterQrCode(in)
	return &__.AddUserDistributionPosterQuCodeResp{
		ImgUrl: url.PosterUrl,
	}, nil
}
func (s *Serve) DistributionRunWaterList(_ context.Context, in *__.DistributionRunWaterListReq) (*__.DistributionRunWaterListResp, error) {
	result := dao.DistributionRunWaterList(in)
	return &__.DistributionRunWaterListResp{
		List: result,
	}, nil
}
func (s *Serve) DistributionSortList(_ context.Context, in *__.DistributionSortListReq) (*__.DistributionSortListResp, error) {
	list := dao.DistributionSortList(in)
	return &__.DistributionSortListResp{
		List: list,
	}, nil
}
